package com.xj.demo.guitooldemo;

import java.util.ArrayList;
import java.util.List;

/**
 * vm args: -Xms100m -Xmx100m -XX:+HeapDumpOnOutOfMemoryError
 */
public class HeapErrorTest01 {
    public static void main(String[] args) {
        List<Picture> list = new ArrayList<>();
        int x = 1;
        int y = 1;
        while (true) {
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            Picture picture = new Picture(x++,y++);
            list.add(picture);
        }

    }
}
class Picture{
    private Integer x;
    private Integer y;

    public Picture(Integer x, Integer y) {
        this.x = x;
        this.y = y;
    }

    public Integer getX() {
        return x;
    }

    public void setX(Integer x) {
        this.x = x;
    }

    public Integer getY() {
        return y;
    }

    public void setY(Integer y) {
        this.y = y;
    }
}